package com.sec.etech.file.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sec.etech.file.model.EtechFile;
import com.sec.etech.file.vo.EtechFileVersionVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

public interface EtechFileMapper extends BaseMapper<EtechFile> {
    List<EtechFileVersionVo> selectFileVersionsByFileId(@Param("uniqueIdentifier") String uniqueIdentifier);

    EtechFile selectById(@Param("id") String id);

    @Select({
            "<script>",
                "SELECT *,preview_ previewPath, thumbnail_ thumbnailPath,unique_identifier_ uniqueIdentifier,rights_json_ rightsJson FROM sys_file where id_ in",
                "<foreach collection='idList' item='item' open='(' separator=',' close=')'>",
                    "#{item}",
                "</foreach>",
            "</script>"
    })
    List<EtechFile> selectBatchIds(@Param("idList") Collection<? extends Serializable> idList);
}
